From fa6adedc42e9c6ec39cc30df16b54900c220b094 Mon Sep 17 00:00:00 2001
From: Armand Philippot <git@armandphilippot.com>
Date: Mon, 20 Dec 2021 00:15:20 +0100
Subject: refactor: rewrite types and services

I was repeating myself a lot in services. So I rewrited the different
functions to improve readability and I extracted some formatting
functions to put them in utils. I also rewrited/reorganized some types
to keep consistent names.
---
 src/pages/article/[slug].tsx | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

(limited to 'src/pages/article/[slug].tsx')

diff --git a/src/pages/article/[slug].tsx b/src/pages/article/[slug].tsx
index 55753c3..bb11220 100644
--- a/src/pages/article/[slug].tsx
+++ b/src/pages/article/[slug].tsx
@@ -4,8 +4,7 @@ import Layout from '@components/Layouts/Layout';
 import PostFooter from '@components/PostFooter/PostFooter';
 import PostHeader from '@components/PostHeader/PostHeader';
 import { t } from '@lingui/macro';
-import { fetchAllPostsSlug } from '@services/graphql/blog';
-import { getPostBySlug } from '@services/graphql/post';
+import { getAllPostsSlug, getPostBySlug } from '@services/graphql/queries';
 import { NextPageWithLayout } from '@ts/types/app';
 import { ArticleProps } from '@ts/types/articles';
 import { loadTranslation } from '@utils/helpers/i18n';
@@ -19,7 +18,7 @@ const SingleArticle: NextPageWithLayout<ArticleProps> = ({ post }) => {
     author,
     comments,
     content,
-    date,
+    dates,
     intro,
     seo,
     subjects,
@@ -36,7 +35,7 @@ const SingleArticle: NextPageWithLayout<ArticleProps> = ({ post }) => {
       <article>
         <PostHeader
           author={author}
-          date={date}
+          dates={dates}
           intro={intro}
           title={title}
           thematics={thematics}
@@ -81,7 +80,7 @@ export const getStaticProps: GetStaticProps = async (
 };
 
 export const getStaticPaths: GetStaticPaths = async () => {
-  const allSlugs = await fetchAllPostsSlug();
+  const allSlugs = await getAllPostsSlug();
 
   return {
     paths: allSlugs.map((post) => `/article/${post.slug}`),
-- 
cgit v1.2.3

